/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
function ValInputAkunUsername(frm, id){ 
    var illegalChars=new Array();
    info=new Array();
    var tErr='';
    var tReq= $("#"+id).attr("rel");
    illegalChars['fNama']=/^[a-zA-Z0-9\ \.\,\@\-\_\/\#\!\+\=]{5,32}$/;
    info['fNama']="<br>Input yang diperbolehkan: [alfabet] [spasi] ' . ,";

    t_value= frm.value;
    tErr=Validating(frm, id, illegalChars, info, t_value, tReq, false);
    return tErr;
}

function ValSubmitAkunSettingUsername(){
    var frm= document.formAkunSetting;
    var tErr='';
    
    tErr+= ValInputAkunUsername(frm.fNama, 'fNama');
    if(tErr==''){
        return false;

    }
    else {
        return true;
    }
    
} 

function ValInputAkunPassword(frm, id){ 
    var illegalChars=new Array();
    info=new Array();
    var tErr='';
    var tReq= $("#"+id).attr("rel");
    illegalChars['fCurrentPassword']=/^[a-zA-Z0-9\ \.\,\@\-\_\/\#\!\+\=]{5,32}$/;
    illegalChars['fNewPassword']=/^[a-zA-Z0-9\ \.\,\@\-\_\/\#\!\+\=]{5,32}$/;
    illegalChars['fConfirmPassword']=/^[a-zA-Z0-9\ \.\,\@\-\_\/\#\!\+\=]{5,32}$/;
    info['fCurrentPassword']="<br>Input yang diperbolehkan: [alfabet] [spasi] ' . ,";
    info['fNewPassword']="<br>Input yang diperbolehkan: [alfabet] [spasi] ' . ,";
    info['fConfirmPassword']="<br>Input yang diperbolehkan: [alfabet] [spasi] ' . ,";
    t_value= frm.value;
    tErr=Validating(frm, id, illegalChars, info, t_value, tReq, false);
    return tErr;
}

function ValSubmitAkunSettingPassword(){
    var frm= document.formAkunSetting;
    var tErr='';
    
    tErr+= ValInputAkunPassword(frm.fCurrentPassword, 'fCurrentPassword');
    tErr+= ValInputAkunPassword(frm.fNewPassword, 'fNewPassword');
    tErr+= ValInputAkunPassword(frm.fConfirmPassword, 'fConfirmPassword');
    if(tErr==''){
        //PERIKSA IS password dan RePassword identik?
        if(frm.fNewPassword.value === frm.fConfirmPassword.value){
            return false;
        }
        else {
            $("#ErrorHandler-Container").html("Password tidak sama. <b>Password</b> dan <b>Ketik Ulang Password</b> harus sama. Silahkan langi lagi!");
            $("#ErrorHandler-Container").fadeIn("normal");
            $("#fConfirmPassword").addClass("error-form");
            $("#fConfirmPassword").focus();
            return true;
        }
    }
    else {
        $("#ErrorHandler-Container").html("Password tidak valid. Lihat ketentuan penggunaan password di bawah!");
        $("#ErrorHandler-Container").fadeIn("normal");
        return true;
    }
    
} 
